package thema2project;

/**
 * generates the thread.
 * @author Rick
 *
 */
class Renner extends Thread {
	protected boolean alive;
	protected Simulator sim;
	protected int step;
	protected boolean running;
	protected int counter;

	public Simulator getSim() {
		return sim;
	}

	public Renner(Simulator sim, int step) {
		this.sim = sim;
		this.step = step;
		counter = step;
		alive = true;
		Thread r = new Thread();
		r.start();
	}

	public void run() {
		while (alive == true) {
			running = true;
			while (alive == true && running == true) {
				sim.simulateOneStep();
				counter--;
				if (counter < 1) {
					running = false;
				}
			}
			alive = false;
		}
	}
}
